<template>
  <BaseContainer>
    <aplid-base-crud ref="crud" class="w-100" v-bind="theConfig">
      <template v-slot:importDialog="{ row, show }">
        <ImportForm @refresh="handleRefresh" :api="theConfig.api" :key="show" :nowRowData="row"></ImportForm>
      </template>
    </aplid-base-crud>
  </BaseContainer>
</template>

<script setup lang="ts">
import { baseConfig } from './config'
import ImportForm from './ImportForm/index.vue'
import { editConfig } from '@/views/datacenter/comprehensiveQueries/utils/index'

type Props = {
  isComprehensiveQueries?:boolean,
}
let props = withDefaults(defineProps<Props>(),{
  isComprehensiveQueries:false,
})
let theConfig :any= ref({})

if(baseConfig){
  let defaultConfig = JSON.parse(JSON.stringify(baseConfig))
  if(props.isComprehensiveQueries){
    theConfig.value = editConfig(defaultConfig)
  }else{
    theConfig.value = baseConfig
  }
}
const crud = ref()
const handleRefresh = (query, visible = false) => {
  nextTick(() => {
    crud.value.refreshChange(query)
  })
}

</script>

<style scoped></style>